package com.xunqi.ad.controller;

import com.alibaba.fastjson.JSON;
import com.xunqi.ad.form.CreativeForm;
import com.xunqi.ad.service.ICreativeService;
import com.xunqi.ad.vo.CreativeResponseVo;
import com.xunqi.ad.vo.ResponseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @Description:
 * @Created with IntelliJ IDEA.
 * @author: 夏沫止水
 * @createTime: 2020-05-01 20:31
 **/

@Slf4j
@RestController
public class CreativeOPController {

    @Resource
    private ICreativeService creativeService;

    @PostMapping(value = "/create/creative")
    public ResponseVo<CreativeResponseVo> createCreative(@Valid @RequestBody CreativeForm form) {

        log.info("ad-sponsor: createCreative -> {}", JSON.toJSONString(form));

        ResponseVo<CreativeResponseVo> creativeResponseVo = creativeService.createCreative(form);

        return creativeResponseVo;
    }

}
